<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Copyright" content="Douco Design." />
<link href="__PUBLIC__/app/admin/css/public.css" rel="stylesheet" type="text/css">
<link href="__PUBLIC__/app/admin/css/page.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__PUBLIC__/app/admin/js/jquery.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/app/admin/js/global.js"></script>
<link rel="stylesheet" href="__PUBLIC__/js/layer/skin/layer.css" />
<script src="__PUBLIC__/js/layer/layer.js" type="text/javascript"></script>

</head>
<body>
  <div class="container">
      


    <!-- <div id="dcMain"> -->
      <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">

        <h3>添加地址</h3>


        <div class="items">
       <!-- <form action="{:U('Member/saveZhangHu')}" method="post" enctype="multipart/form-data"> -->
        <div id="member_id" value="{$member_account.member_id}">
        <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
      
        <tr>
           <th width="131">名称</th>
           <th>内容</th>
        </tr>
       
          <tr>
           <td align="right">收件人: </td>
          <td>
         
            <input type="text" name="userName"  class="inpMain" id="userName" >
          </td>
                 

         </tr> 
         <tr>
           <td align="right">联系方式: </td>

                 <td><input type="text" name="userPhone" id="userPhone" class="inpMain"></td>

         </tr> 
        
       <tr>
           <td align="right">省市信息: </td>
          <td>
          <div class="form-group">
              <div class="form-group">
                 <div class="col-lg-4">
                   <select name="pro" id="pro" >
                    <option>--请选择城市--</option>
                    <foreach name="region" item="v">
                       <option value="{$v.id}">{$v.area_name}</option>
                     </foreach>
                 </select>
           <select name="city" id="city">
              <option></option>
          </select>
           <select name="area" id="area">
              <option></option>
          </select>
                        </div>
                      </div>
                    </td>
                 

         </tr> 
                <tr>
           <td align="right">详细地址: </td>

                 <td><input type="text" name="address"  id="address" class="inpMain"></td>

         </tr> 
                         <tr>
           <td align="right">邮政编码: </td>

                 <td><input type="text" name="postCode" id="postCode" class="inpMain"></td>

         </tr> 
        </table>
        </div>
        <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
         <tr>
          <td width="131"></td>
          <td>
           <input name="submit" class="btn" type="submit" value="提交" onclick="subaddress()" />
          </td>
         </tr>
        </table>
        <!-- </form> -->
      </div>
      <br>
        <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
            <tr>
                <th>选择</th>
                <th align="center">ID</th>
                <th align="center">收件人</th>
                <th align="center">联系方式</th>
                <th align="center">省</th>
                <th align="center">市</th>
                <th align="center">区</th>
                <th align="center">详细地址</th>
                <th align="center">邮政编码</th>
                <th align="center">新增时间</th>
            </tr>
           <volist name="list" id="vr" empty="$empty">
            <tr>
              <td> <eq name="vr.isDefault" value="0"><input type="radio" onclick="moren({$vr.addressId})" id="radio"></eq> <eq name="vr.isDefault" value="1">默认</eq></td>
                <td align="center">{$vr.addressId}</td> 
                <td align="center">{$vr.userName}</td>
                <td align="center">{$vr.userPhone}</td>
                <td align="center">{$vr.areaName}</td>
                <td align="center">{$vr.areaName1}</td>
                 <td align="center">{$vr.areaName2}</td>
                 <td align="center">{$vr.address}</td>
                 <td align="center">{$vr.postCode}</td>
                <td align="center">{$vr.createTime|date="Y-m-d H:i:s",###}</td>
               
            </tr>
            </volist>
        </table>
         <input type="hidden" name="userId" value="{$member}" id="userId">
        {$page}
        </div>



  </div>
<!--以下内容不要管-->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="pswp__bg"></div>
  <div class="pswp__scroll-wrap">
    <div class="pswp__container">
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
    </div>
    <div class="pswp__ui pswp__ui--hidden">
      <div class="pswp__top-bar">
        <div class="pswp__counter"></div>
        <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
        <div class="pswp__preloader">
          <div class="pswp__preloader__icn">
            <div class="pswp__preloader__cut">
                <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
             </div>
             <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
              <div class="pswp__share-tooltip"></div> 
             </div>
             <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button>
             <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button>
             <div class="pswp__caption">
              <div class="pswp__caption__center"></div>
       </div>
    </div>
  </div>
</div>

    </body>
</html>
<script type="text/javascript">
    function subJiFen(id){
        var money = $('#money').val();
        var url="{:U('Member/chongzhi')}";
        $.post(url,{'member_id':id,'money':money},function(data){
            layer.msg(data.info);
            if(data.status==1){
                setTimeout(function () { 
                    window.location.reload();
                }, 2000);
            }
        });
    }






</script>






<script>
    $('#pro').change(function(){
     var url = "{:U('Member/area')}";
     var pro_id = $('#pro').val();
     $.post(url,{'pro_id':pro_id},function(data){
       $('#city').html(data);
     });
    });
    $('#city').change(function(){
     var url = "{:U('Member/area')}";
     var pro_id = $('#city').val();
     $.post(url,{'pro_id':pro_id},function(data){
       $('#area').html(data);
     });
    });  



function subaddress()
{
  var userId = $("#userId").val();
  var userName = $("#userName").val();
  var areaId1 = $("#pro").val();
  var areaId2 = $("#city").val();
  var areaId3 = $("#area").val();
  var address = $("#address").val();
  var postCode = $("#postCode").val();
  var userPhone = $("#userPhone").val();
 var url="{:U('Member/insertaddress')}";

    $.post(url,{'userId':userId,'userName':userName,'areaId1':areaId1,'areaId2':areaId2,'areaId3':areaId3,'address':address,'postCode':postCode,'userPhone':userPhone},function(data){
      layer.msg(data.info);
      if(data.status==1){
          setTimeout(function () { 
              window.location.reload();
          }, 2000);
      }
  });
}

function moren(id)
{ 
  $("input:radio").each(function(){
   $("input:radio:not([checked])").attr("disabled","disabled");
  });
  var url="{:U('Member/moren')}";
    $.post(url,{'id':id},function(data){
      layer.msg(data.info);
      if(data.status==1){
          setTimeout(function () { 
              window.location.reload();
          }, 2000);
      }
  });
}
</script>